﻿namespace BambuBusParser;

public class FlashSaveStruct
{
    public Filament[,] Filament;
    public int BambuBusNowFilamentNum { get; set; }
    public uint Version { get; set; }
    public uint Check { get; set; }
    public static FlashSaveStruct Instance { get; set; } = CreateDefault();


    // 初始化方法
    private static FlashSaveStruct CreateDefault()
    {
        var dataSave = new FlashSaveStruct
        {
            Filament = new Filament[4, 4], // 4x4 矩阵展平
            BambuBusNowFilamentNum = 0,
            Version = Constants.BambubusVersion,
            Check = 0x40614061
        };

        for (int i = 0; i < dataSave.Filament.Length; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                dataSave.Filament[i, j] = new Filament
                {
                    ID = "GFG00",
                    ColorR = 0xFF,
                    ColorG = 0xFF,
                    ColorB = 0xFF,
                    ColorA = 0xFF,
                    TemperatureMin = 220,
                    TemperatureMax = 240,
                    Name = "PETG",
                    Meters = 0,
                    Status = FilamentStatus.Online,
                    MotionSet = FilamentMotionState.Idle,
                    Pressure = 0
                };
            }
        }

        return dataSave;
    }
}